var G5_Comp = Window05.extend({
	parent:null,
	comp_close:null,
	open_comp:null,
	comp_open:null,
	flow:null,
	status:true,
	ctor:function (parent,flow, tag) {
		this._super(parent,flow, tag);
		this.parent=parent;
		this.flow=flow;
	},
	initSp:function (){
		this.comp_close=new Button(this.rootNode,2,TAG_ITEM_COMPCLOSE1,"#equitment/computer_close.png",this.eventMenuCallback,this);
		this.comp_close.setScale(2);
		this.comp_close.setPosition(cc.p(gg.c_width, gg.c_height));
		
		this.open_comp=new Button(this.rootNode,3,TAG_ITEM_OPENCOMP,"#c1.png",this.eventMenuCallback,this);
		this.open_comp.setPosition(cc.p(gg.c_width*1.33, gg.c_height*0.86));
		
		this.close_comp=new Button(this.rootNode,3,TAG_ITEM_CLOSECOMP,"#c1.png",this.eventMenuCallback,this);
		this.close_comp.setPosition(cc.p(gg.c_width*1.33, gg.c_height*0.86));
		this.close_comp.setVisible(false);
		
		this.comp_open=new Button(this.rootNode,2,TAG_ITEM_COMPOPEN1,"#equitment/computer_open.png",this.eventMenuCallback,this);
		this.comp_open.setScale(2);
		this.comp_open.setPosition(cc.p(gg.c_width, gg.c_height));
		this.comp_open.setVisible(false);
		
		this.software=new Button(this.rootNode,3,TAG_ITEM_SOFTWARE,"#software_button/G5.png",this.eventMenuCallback,this);
		this.software.setPosition(cc.p(gg.c_width*0.7, gg.c_height*1.4));
		this.software.setVisible(false);
		if(gg.teach_type == TAG_LEAD){
		this.show=new Button(this.rootNode,3,TAG_BUTTON_SHOW,"#software_button/show.png",this.eventMenuCallback,this);
		this.show.setPosition(cc.p(gg.c_width*1.551, gg.c_height*1.452));
		this.show.setVisible(false);
		
		this.setNum=new Button(this.rootNode,3,TAG_BUTTON_SETNUM,"#software_button/setNum.png",this.eventMenuCallback,this);
		this.setNum.setPosition(cc.p(gg.c_width*0.962,gg.c_height*1.08));
		this.setNum.setVisible(false);
		
		this.heat_sure=new Button(this.rootNode,3,TAG_BUTTON_HEATSURE,"#software_button/heat_sure.png",this.eventMenuCallback,this);
		this.heat_sure.setPosition(cc.p(gg.c_width*1.036,gg.c_height*1.085));
		this.heat_sure.setVisible(false);
		
		this.heat=new Button(this.rootNode,3,TAG_BUTTON_HEAT,"#software_button/heat.png",this.eventMenuCallback,this);
		this.heat.setPosition(cc.p(gg.c_width*1.148,gg.c_height*1.085));
		this.heat.setVisible(false);
		
		this.addPlan=new Button(this.rootNode,3,TAG_BUTTON_ADDPLAN,"#software_button/addplan.png",this.eventMenuCallback,this);
		this.addPlan.setPosition(cc.p(gg.c_width*0.445,gg.c_height*1.62));
		this.addPlan.setVisible(false);
		
		this.detection=new Button(this.rootNode,3,TAG_BUTTON_DETECTION,"#software_button/detection.png",this.eventMenuCallback,this);
		this.detection.setPosition(cc.p(gg.c_width*0.868,gg.c_height*1.241));
		this.detection.setVisible(false);
		
		this.ignition=new Button(this.rootNode,3,TAG_BUTTON_IGNITION,"#software_button/ignition.png",this.eventMenuCallback,this);
		this.ignition.setPosition(cc.p(gg.c_width*0.86, gg.c_height*1.01));
		this.ignition.setVisible(false);
		
		this.plan_sure=new Button(this.rootNode,3,TAG_BUTTON_PLANSURE,"#software_button/plan_sure.png",this.eventMenuCallback,this);
		this.plan_sure.setPosition(cc.p(gg.c_width*0.914,gg.c_height*0.865));
		this.plan_sure.setVisible(false);
		
		this.add=new Button(this.rootNode,3,TAG_BUTTON_ADD,"#software_button/add.png",this.eventMenuCallback,this);
		this.add.setPosition(cc.p(gg.c_width*0.04,gg.c_height*1.236));
		this.add.setVisible(false);
		
		this.selected1=new Button(this.rootNode,3,TAG_BUTTON_SELECTED1,"#software_button/selected1.png",this.eventMenuCallback,this);
		this.selected1.setPosition(cc.p(gg.c_width*1.288, gg.c_height*1.3268));
		this.selected1.setVisible(false);
		
		this.time=new Button(this.rootNode,3,TAG_BUTTON_TIME,"#software_button/time.png",this.eventMenuCallback,this);
		this.time.setPosition(cc.p(gg.c_width*0.817, gg.c_height*1.0365));
		this.time.setVisible(false);
		
		this.selected2=new Button(this.rootNode,3,TAG_BUTTON_SELECTED2,"#software_button/selected2.png",this.eventMenuCallback,this);
		this.selected2.setPosition(cc.p(gg.c_width*1.231, gg.c_height*1.021));
		this.selected2.setVisible(false);
		
		this.set=new Button(this.rootNode,3,TAG_BUTTON_SET,"#software_button/set.png",this.eventMenuCallback,this);
		this.set.setPosition(cc.p(gg.c_width*0.3,gg.c_height*1.24));
		this.set.setVisible(false);
		
		this.sampling=new Button(this.rootNode,3,TAG_BUTTON_SAMPLING,"#software_button/sampling.png",this.eventMenuCallback,this);
		this.sampling.setPosition(cc.p(gg.c_width*0.798, gg.c_height*0.6));
		this.sampling.setVisible(false);
		}else{
			this.show=new Button(this.rootNode,3,TAG_BUTTON_SHOW,"#software_button/show1.png",this.eventMenuCallback,this);
			this.show.setPosition(cc.p(gg.c_width*1.551, gg.c_height*1.452));
			this.show.setVisible(false);

			this.setNum=new Button(this.rootNode,3,TAG_BUTTON_SETNUM,"#software_button/setNum1.png",this.eventMenuCallback,this);
			this.setNum.setPosition(cc.p(gg.c_width*0.962,gg.c_height*1.08));
			this.setNum.setVisible(false);

			this.heat_sure=new Button(this.rootNode,3,TAG_BUTTON_HEATSURE,"#software_button/heat_sure1.png",this.eventMenuCallback,this);
			this.heat_sure.setPosition(cc.p(gg.c_width*1.036,gg.c_height*1.085));
			this.heat_sure.setVisible(false);

			this.heat=new Button(this.rootNode,3,TAG_BUTTON_HEAT,"#software_button/heat1.png",this.eventMenuCallback,this);
			this.heat.setPosition(cc.p(gg.c_width*1.148,gg.c_height*1.085));
			this.heat.setVisible(false);

			this.addPlan=new Button(this.rootNode,3,TAG_BUTTON_ADDPLAN,"#software_button/addplan1.png",this.eventMenuCallback,this);
			this.addPlan.setPosition(cc.p(gg.c_width*0.445,gg.c_height*1.62));
			this.addPlan.setVisible(false);

			this.detection=new Button(this.rootNode,3,TAG_BUTTON_DETECTION,"#software_button/detection1.png",this.eventMenuCallback,this);
			this.detection.setPosition(cc.p(gg.c_width*0.868,gg.c_height*1.241));
			this.detection.setVisible(false);

			this.ignition=new Button(this.rootNode,3,TAG_BUTTON_IGNITION,"#software_button/ignition1.png",this.eventMenuCallback,this);
			this.ignition.setPosition(cc.p(gg.c_width*0.86, gg.c_height*1.01));
			this.ignition.setVisible(false);

			this.plan_sure=new Button(this.rootNode,3,TAG_BUTTON_PLANSURE,"#software_button/plan_sure1.png",this.eventMenuCallback,this);
			this.plan_sure.setPosition(cc.p(gg.c_width*0.914,gg.c_height*0.865));
			this.plan_sure.setVisible(false);

			this.add=new Button(this.rootNode,3,TAG_BUTTON_ADD,"#software_button/add1.png",this.eventMenuCallback,this);
			this.add.setPosition(cc.p(gg.c_width*0.04,gg.c_height*1.236));
			this.add.setVisible(false);

			this.selected1=new Button(this.rootNode,3,TAG_BUTTON_SELECTED1,"#software_button/selected1_1.png",this.eventMenuCallback,this);
			this.selected1.setPosition(cc.p(gg.c_width*1.288, gg.c_height*1.3268));
			this.selected1.setVisible(false);

			this.time=new Button(this.rootNode,3,TAG_BUTTON_TIME,"#software_button/time1.png",this.eventMenuCallback,this);
			this.time.setPosition(cc.p(gg.c_width*0.817, gg.c_height*1.0365));
			this.time.setVisible(false);

			this.selected2=new Button(this.rootNode,3,TAG_BUTTON_SELECTED2,"#software_button/selected2_1.png",this.eventMenuCallback,this);
			this.selected2.setPosition(cc.p(gg.c_width*1.231, gg.c_height*1.021));
			this.selected2.setVisible(false);

			this.set=new Button(this.rootNode,3,TAG_BUTTON_SET,"#software_button/set1.png",this.eventMenuCallback,this);
			this.set.setPosition(cc.p(gg.c_width*0.3,gg.c_height*1.24));
			this.set.setVisible(false);

			this.sampling=new Button(this.rootNode,3,TAG_BUTTON_SAMPLING,"#software_button/sampling1.png",this.eventMenuCallback,this);
			this.sampling.setPosition(cc.p(gg.c_width*0.798, gg.c_height*0.6));
			this.sampling.setVisible(false);
		}
	},
	eventMenuCallback:function(pSender){
		this.showDesc(pSender.getTag());
		if(cur_tool != TAG_BUTTON_HAND){
			// 描述
			return;
		}
		if(!this.flow.checkTag(pSender.getTag())){
			// 是否可以触发
			_.error();
			this.scene.tipLayer.updateScore(gg.score);
			return;
		} else {
			if(this.status==true){
				_.clever();
				this.scene.tipLayer.updateScore(gg.score);
			}
		
		}
		var action = this.flow.flow.action;
		var func=cc.callFunc(this.checkActionDone,this);
		var func1=cc.callFunc(this.close,this);
		var func2=cc.callFunc(this.next,this);
		switch(pSender.getTag()){
		case TAG_ITEM_OPENCOMP:
			this.flow.next();
			this.comp_open.setVisible(true);
			this.comp_close.setVisible(false);
			this.software.setVisible(true);
			this.parent.comp_open.setVisible(true);
			this.parent.comp_close.setVisible(false);
			this.close();
			break;
		case TAG_ITEM_SOFTWARE:
			this.flow.next();
			this.bg.setTexture(res_play05.G5_Software1);
			this.bg.setTextureRect(cc.rect(0, 0,1006,537));
			this.comp_open.setVisible(false);
			this.open_comp.setVisible(false);
			this.software.setVisible(false);
			this.show.setVisible(true);
			this.parent.comp_open.setVisible(false);
			this.parent.comp_software.setVisible(true);
			break;
		case TAG_BUTTON_SHOW:
			this.flow.next();
			this.bg.setTexture(res_play05.G5_Software2);
			this.show.setVisible(false);
			this.setNum.setVisible(true);
			break;
		case TAG_BUTTON_SETNUM:
			this.flow.next();
			this.setNum.setVisible(false);
			this.heat_sure.setVisible(true);
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software3);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software4);
				this.heat_sure.setPositionY(gg.c_height*1.039);
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO3){
				this.bg.setTexture(res_play05.G5_Software5);
				this.heat_sure.setPositionY(gg.c_height*0.958);
				ll.tip.arr.pos(gg.flow.curSprite);
			}
			break;
		case TAG_BUTTON_HEATSURE:
			this.flow.next();
			this.heat_sure.setVisible(false);
			if(action==ACTION_DO1){
				this.heat.setVisible(true);
			}else if(action==ACTION_DO2){
				this.heat.setVisible(true);
				this.heat.setPositionY(gg.c_height*1.042);
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO3){
				this.heat.setVisible(true);
				this.heat.setPositionY(gg.c_height*0.960);
				ll.tip.arr.pos(gg.flow.curSprite);
			}
			break;
		case TAG_BUTTON_HEAT:
			this.flow.next();
			this.heat.setVisible(false);
			if(action==ACTION_DO1){
				this.setNum.setVisible(true);
				this.setNum.setPositionY(gg.c_height*1.039);
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO2){
				this.setNum.setVisible(true);
				this.setNum.setPositionY(gg.c_height*0.955);
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO3){
				this.close();
			}
			break;
		case TAG_BUTTON_ADDPLAN:
			this.flow.next();
			this.bg.setTexture(res_play05.G5_Software7);
			this.addPlan.setVisible(false);
			this.plan_sure.setVisible(true);
			break;
		case TAG_BUTTON_DETECTION:
			this.flow.next();
			this.bg.setTexture(res_play05.G5_Software6);
			this.detection.setVisible(false);
			this.ignition.setVisible(true);
			break;
		case TAG_BUTTON_IGNITION:
			if(this.status=true){
				this.ignition.setVisible(false);
				this.ignition.runAction(cc.sequence(func1,func,cc.delayTime(4),func2));
				this.parent.comp_software.setVisible(false);
				this.parent.comp_software1.setVisible(true);
			}
			this.status=false;
			break;
		case TAG_BUTTON_PLANSURE:
			this.flow.next();
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software8);
				this.plan_sure.setVisible(false);
				this.add.setVisible(true);
			}else if(action==ACTION_DO2){
				this.plan_sure.setVisible(false);
				this.bg.setTexture(res_play05.G5_Software9);
				this.set.setVisible(true);
			}else if(action==ACTION_DO3){
				this.plan_sure.setVisible(false);
				this.bg.setTexture(res_play05.G5_Software16);
				this.set.setVisible(true);
				this.set.setPosition(cc.p(gg.c_width*0.3,gg.c_height*1.189));
				ll.tip.arr.pos(gg.flow.curSprite);
			}
			break;
		case TAG_BUTTON_ADD:
			this.flow.next();
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software8_1);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software15_1);
			}
			this.add.setVisible(false);
			this.selected1.setVisible(true);
			break;
		case TAG_BUTTON_SELECTED1:
			this.flow.next();
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software8_2);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software15_2);
			}
			this.selected1.setVisible(false);
			this.time.setVisible(true);
			break;
		case TAG_BUTTON_TIME:
			this.flow.next();
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software8_3);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software15_3);
			}
			this.time.setVisible(false);
			this.selected2.setVisible(true);
			break;
		case TAG_BUTTON_SELECTED2:
			this.flow.next();
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software8_4);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software15_4);
			}
			this.selected2.setVisible(false);
			this.plan_sure.setVisible(true);
			this.plan_sure.setPosition(cc.p(gg.c_width*1.25, gg.c_height*0.7));
			ll.tip.arr.pos(gg.flow.curSprite);
			break;
		case TAG_BUTTON_SET:
			if(this.status==true){
				if(action==ACTION_DO1){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}else if(action==ACTION_DO2){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}else if(action==ACTION_DO3){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}else if(action==ACTION_DO4){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}else if(action==ACTION_DO5){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}else if(action==ACTION_DO6){
					this.set.runAction(cc.sequence(func,func1,cc.delayTime(1),func2));
				}
			}
			this.status=false;
			break;
		case TAG_BUTTON_SAMPLING:
			if(action!=ACTION_DO6){
				this.flow.next();
			}
			if(action==ACTION_DO1){
				this.bg.setTexture(res_play05.G5_Software11);
				this.sampling.setVisible(false);
				this.set.setVisible(true);
				this.set.setPosition(cc.p(gg.c_width*0.3+22,gg.c_height*1.24));
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software13);
				this.sampling.setVisible(false);
				this.set.setVisible(true);
				this.set.setPosition(cc.p(gg.c_width*0.3+44,gg.c_height*1.24));
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO3){
				this.bg.setTexture(res_play05.G5_Software15);
				this.sampling.setVisible(false);
				this.add.setVisible(true);
				this.add.setPosition(cc.p(gg.c_width*0.04,gg.c_height*1.193));
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO4){
				this.bg.setTexture(res_play05.G5_Software18);
				this.sampling.setVisible(false);
				this.set.setVisible(true);
				this.set.setPosition(cc.p(gg.c_width*0.343,gg.c_height*1.189));
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO5){
				this.bg.setTexture(res_play05.G5_Software19);
				this.sampling.setVisible(false);
				this.set.setVisible(true);
				this.set.setPosition(cc.p(gg.c_width*0.385,gg.c_height*1.193));
				ll.tip.arr.pos(gg.flow.curSprite);
			}else if(action==ACTION_DO6){
				this.bg.setTexture(res_play05.G5_Software20);
				this.sampling.setVisible(false);
				this.sampling.runAction(cc.sequence(cc.delayTime(2),cc.callFunc(function(){
					this.close();
				},this),cc.delayTime(0.5),cc.callFunc(function(){
					this.flow.next();
				},this)));
			}
			break;
		case TAG_ITEM_CLOSECOMP:
			this.parent.comp_software3.setVisible(false);
			this.parent.comp_close.setVisible(true);
			this.close_comp.runAction(cc.sequence(func,func1,cc.delayTime(4),func2));
			break;
		default:
			break;
		}
	},
	next:function(){
		this.flow.next();
	},
	run:function(){
		this.parent.clock.setVisible(true);
		this.parent.point.setVisible(true);
		var rotate=cc.rotateBy(3,720);
		this.parent.point.runAction(cc.sequence(rotate,cc.callFunc(function b(){
			this.parent.clock.setVisible(false);
			this.parent.clock1.setVisible(true);
		},this),cc.delayTime(1),cc.callFunc(function a(){
			this.parent.clock1.setVisible(false);
			this.parent.point.setVisible(false);
		},this)));

	},
	checkActionDone:function(pSender){
		var tag=pSender.getTag();
		var action = this.flow.flow.action;
		if(tag==TAG_BUTTON_SET){
			this.set.setVisible(false);
			if(action==ACTION_DO1){
				this.parent.comp_software1.setVisible(false);
				this.parent.comp_software2.setVisible(true);
				this.bg.setTexture(res_play05.G5_Software10);
			}else if(action==ACTION_DO2){
				this.bg.setTexture(res_play05.G5_Software12);
			}else if(action==ACTION_DO3){
				this.bg.setTexture(res_play05.G5_Software14);
			}else if(action==ACTION_DO4){
				this.bg.setTexture(res_play05.G5_Software17);
				this.parent.comp_software2.setVisible(false);
				this.parent.comp_software3.setVisible(true);
			}else if(action==ACTION_DO5){
				this.bg.setTexture(res_play05.G5_Software17);
			}else if(action==ACTION_DO6){
				this.bg.setTexture(res_play05.G5_Software17);
			}
		}else if(tag==TAG_BUTTON_IGNITION){
			this.run();
		}else if(tag==TAG_ITEM_CLOSECOMP){
			this.run();
		}
		this.status=true;
	}
});